$(function(){
    
    $("#form_aluno").validate({
        onfocusout: function (element) {
            $(element).valid();
        },
        errorPlacement: function(error, element) 
        {
            element.attr('title', error.text());
            $(".error").tooltip({   
                position: {
                    my: "center bottom-10",
                    at: "right top",
                    using: function(position, feedback) {
                        $(this).css(position);
                        $("<div>").addClass("arrow").addClass(feedback.vertical).addClass(feedback.horizontal).appendTo(this);
                    }
                },
                tooltipClass: "ttError"
            }); 
        },
        rules: {
            ALU_SNH: { required: true, minlength: 6 },
            ALU_SNH2: { required: true, minlength: 6, equalTo: "#ALU_SNH" },
        },
    });
    
    $('#ALU_LOG').blur(function() {
        el = $(this);
        $.post(URLBASE+'/aluno/validarlogin/',{ id:$('#ALU_ID').val(), login:$(this).val() },function(data) {
            if(data.ok){ alert(data.msg); el.focus(); }
         }, 'json');
        return false;
    });
    
});

